package tech.heptagram.staff.cas.config.cas.domain;


import org.springframework.security.core.GrantedAuthority;

import lombok.Data;

@Data
public class AuthorityInfo implements GrantedAuthority {

    public static final String ROLE = "role";

    public static final String OPERATE = "operate";

    /**
     * 编号 ROLE_id 的形式
     */
    private String authority;
    /**
     * 身份名称
     */
    private String name;
    /**
     * 描述信息
     */
    private String text;

    /**
     * 类型
     */
    private String type;

    private Integer menuId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AuthorityInfo)) return false;

        AuthorityInfo that = (AuthorityInfo) o;

        return authority.equals(that.authority);
    }

    @Override
    public int hashCode() {
        return authority.hashCode();
    }

    @Override
    public String toString() {
        return this.getAuthority();
    }
}
